<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        a {
            text-decoration: none;
        }
    </style>
</head>

<body>


    <script>
        let data = [
            { value: '1', text: '包装', children: [{ value: '1-1', text: '箱装' }, { value: '1-2', text: '桶装' }] },
            { value: '2', text: '工艺', children: [{ value: '2-1', text: '压榨' }, { value: '2-2', text: '浸出' }] },
            { value: '3', text: '净含量', children: [{ value: '3-1', text: '1L' }, { value: '3-2', text: '2L' }] },
        ];
        function combination(data) {
            let sarr = [[]];
            let result = [];
            for (let i = 0; i < data.length; i++) {
                let tarr = [];
                for (let j = 0; j < sarr.length; j++) {
                    for (let k = 0; k < data[i].length; k++) {
                        tarr.push(sarr[j].concat(data[i][k]));
                    }
                }
                sarr = tarr;
            }
            for (let m = 0; m < sarr.length; m++) {
                // result.push(sarr[m].join('.'));
                result.push(sarr[m]);
            }
            return result;
        }
        let data2=[];
        data.forEach(item=>{
            data2.push(item.children);
        })
        console.log(combination(data2));

        // function combination(data) {
        //     let sarr = [[]];
        //     let result = [];
        //     for (let i = 0; i < data.length; i++) {
        //         let tarr = [];
        //         for (let j = 0; j < sarr.length; j++) {
        //             for (let k = 0; k < data[i].length; k++) {
        //                 tarr.push(sarr[j].concat(data[i][k]));
        //             }
        //         }
        //         sarr = tarr;
        //     }
        //     for (let m = 0; m < sarr.length; m++) {
        //         // result.push(sarr[m].join('.'));
        //         result.push(sarr[m]);
        //     }
        //     return result;
        // }
        // let garr = [["a", "b"], ["1", "2"]];
        // console.log(combination(garr));
    </script>
</body>

</html>